
function init (methods = {}) {
  let ws = new WebSocket(methods.url)
  ws.onopen = methods.open
  ws.onerror = methods.error
  ws.onmessage = methods.msg
  ws.onclose = methods.close
  return ws
}

export default {init}
